﻿' ''' <summary>
' ''' Provides access to game assets such as images, audio, and game-data values.
' ''' </summary>
' ''' <remarks>
' ''' The AssetBank is a string-keyed DictionaryBank with predefined methods for getting
' ''' and setting audio, image, integer, single, and string data.  Audio and Images
' ''' are loaded from the AssetManager's specified asset directory.  The AssetBank
' ''' serves as a cache for assets; the first time a particular asset is requested
' ''' from the bank, the bank loads that asset from the AssetManager (which in-turn
' ''' either serves the asset from it's local cache, or loads the asset from disk).
' ''' Subsequent requests for the same asset from this AssetBank will result in
' ''' the asset being returned from cache.
' ''' </remarks>
'Public Class AssetBank
'    Inherits DictionaryBank(Of String)

'    Protected _Assets As AssetManager

'    Public Sub New(ByVal resources As AssetManager)
'        _Assets = resources
'    End Sub

'    ''' <summary>
'    ''' Determines if an audio asset with the specified name has been loaded into this bank.
'    ''' </summary>
'    ''' <param name="assetName">The name of the audio asset to look for.</param>
'    ''' <returns>True if an audio asset with the specified name has been loaded; otherwise false.</returns>
'    ''' <remarks>
'    ''' This method is only concerned with whether or not the asset has been loaded into this
'    ''' particular asset bank instance.  When this method returns true, calling the associated
'    ''' {Get} method will return the asset from this asset bank's local cache. When this method
'    ''' returns false, calling the associated {Get} method will cause the asset bank to attempt 
'    ''' to load the asset through the local asset manager reference. The asset manager will then
'    ''' attempt to return the asset from its local cache if it has been previously loaded. If 
'    ''' not, the asset manager tries to find an asset of the appropriate type with
'    ''' the specified name in the asset path folder, and then load that asset and return it
'    ''' to the asset bank (which will in turn cache the asset for future use and return it).
'    ''' If the asset manager fails to find a matching asset, an ArgumentException is thrown.
'    ''' </remarks>
'    Public Function ContainsAudio(ByVal assetName As String) As Boolean
'        Return Me.ContainsKey(Of Uri)(assetName)
'    End Function

'    ''' <summary>
'    ''' Determines if an image asset with the specified name has been loaded into this bank.
'    ''' </summary>
'    ''' <param name="assetName">The name of the image asset to look for.</param>
'    ''' <returns>True if an image asset with the specified name has been loaded; otherwise false.</returns>
'    ''' <remarks>
'    ''' This method is only concerned with whether or not the asset has been loaded into this
'    ''' particular asset bank instance.  When this method returns true, calling the associated
'    ''' {Get} method will return the asset from this asset bank's local cache. When this method
'    ''' returns false, calling the associated {Get} method will cause the asset bank to attempt 
'    ''' to load the asset through the local asset manager reference. The asset manager will then
'    ''' attempt to return the asset from its local cache if it has been previously loaded. If 
'    ''' not, the asset manager tries to find an asset of the appropriate type with
'    ''' the specified name in the asset path folder, and then load that asset and return it
'    ''' to the asset bank (which will in turn cache the asset for future use and return it).
'    ''' If the asset manager fails to find a matching asset, an ArgumentException is thrown.
'    ''' </remarks>
'    Public Function ContainsBitmap(ByVal assetName As String) As Boolean
'        Return ContainsKey(Of Bitmap)(assetName)
'    End Function

'    Public Function ContainsDefinitionFile(assetName As String) As Boolean
'        Return ContainsKey(Of String())(assetName)
'    End Function

'    ''' <summary>
'    ''' Determines if an flag, or boolean, asset with the specified name has been loaded into this bank.
'    ''' </summary>
'    ''' <param name="assetName">The name of the flag asset to look for.</param>
'    ''' <returns>True if an flag (boolean) asset with the specified name has been loaded; otherwise false.</returns>
'    ''' <remarks>
'    ''' This method is only concerned with whether or not the asset has been loaded into this
'    ''' particular asset bank instance.  When this method returns true, calling the associated
'    ''' {Get} method will return the asset from this asset bank's local cache. When this method
'    ''' returns false, calling the associated {Get} method will cause the asset bank to attempt 
'    ''' to load the asset through the local asset manager reference. The asset manager will then
'    ''' attempt to return the asset from its local cache if it has been previously loaded. If 
'    ''' not, the asset manager tries to find an asset of the appropriate type with
'    ''' the specified name in the asset path folder, and then load that asset and return it
'    ''' to the asset bank (which will in turn cache the asset for future use and return it).
'    ''' If the asset manager fails to find a matching asset, an ArgumentException is thrown.
'    ''' </remarks>
'    Public Function ContainsFlag(assetName As String) As Boolean
'        Return ContainsKey(Of Boolean)(assetName)
'    End Function

'    ''' <summary>
'    ''' Determines if an integer asset with the specified name has been loaded into this bank.
'    ''' </summary>
'    ''' <param name="assetName">The name of the integer asset to look for.</param>
'    ''' <returns>True if an integer asset with the specified name has been loaded; otherwise false.</returns>
'    ''' <remarks>
'    ''' This method is only concerned with whether or not the asset has been loaded into this
'    ''' particular asset bank instance.  When this method returns true, calling the associated
'    ''' {Get} method will return the asset from this asset bank's local cache. When this method
'    ''' returns false, calling the associated {Get} method will cause the asset bank to attempt 
'    ''' to load the asset through the local asset manager reference. The asset manager will then
'    ''' attempt to return the asset from its local cache if it has been previously loaded. If 
'    ''' not, the asset manager tries to find an asset of the appropriate type with
'    ''' the specified name in the asset path folder, and then load that asset and return it
'    ''' to the asset bank (which will in turn cache the asset for future use and return it).
'    ''' If the asset manager fails to find a matching asset, an ArgumentException is thrown.
'    ''' </remarks>
'    Public Function ContainsInteger(ByVal assetName As String) As Boolean
'        Return ContainsKey(Of Integer)(assetName)
'    End Function

'    ''' <summary>
'    ''' Determines if a Single asset with the specified name has been loaded into this bank.
'    ''' </summary>
'    ''' <param name="assetName">The name of the Single asset to look for.</param>
'    ''' <returns>True if a Single asset with the specified name has been loaded; otherwise false.</returns>
'    ''' <remarks>
'    ''' This method is only concerned with whether or not the asset has been loaded into this
'    ''' particular asset bank instance.  When this method returns true, calling the associated
'    ''' {Get} method will return the asset from this asset bank's local cache. When this method
'    ''' returns false, calling the associated {Get} method will cause the asset bank to attempt 
'    ''' to load the asset through the local asset manager reference. The asset manager will then
'    ''' attempt to return the asset from its local cache if it has been previously loaded. If 
'    ''' not, the asset manager tries to find an asset of the appropriate type with
'    ''' the specified name in the asset path folder, and then load that asset and return it
'    ''' to the asset bank (which will in turn cache the asset for future use and return it).
'    ''' If the asset manager fails to find a matching asset, an ArgumentException is thrown.
'    ''' </remarks>
'    Public Function ContainsSingle(ByVal assetName As String) As Boolean
'        Return ContainsKey(Of Single)(assetName)
'    End Function

'    ''' <summary>
'    ''' Determines if an string asset with the specified name has been loaded into this bank.
'    ''' </summary>
'    ''' <param name="assetName">The name of the string asset to look for.</param>
'    ''' <returns>True if a string asset with the specified name has been loaded; otherwise false.</returns>
'    ''' <remarks>
'    ''' This method is only concerned with whether or not the asset has been loaded into this
'    ''' particular asset bank instance.  When this method returns true, calling the associated
'    ''' {Get} method will return the asset from this asset bank's local cache. When this method
'    ''' returns false, calling the associated {Get} method will cause the asset bank to attempt 
'    ''' to load the asset through the local asset manager reference. The asset manager will then
'    ''' attempt to return the asset from its local cache if it has been previously loaded. If 
'    ''' not, the asset manager tries to find an asset of the appropriate type with
'    ''' the specified name in the asset path folder, and then load that asset and return it
'    ''' to the asset bank (which will in turn cache the asset for future use and return it).
'    ''' If the asset manager fails to find a matching asset, an ArgumentException is thrown.
'    ''' </remarks>
'    Public Function ContainsString(ByVal assetName As String) As Boolean
'        Return ContainsKey(Of String)(assetName)
'    End Function

'    ''' <summary>
'    ''' Gets the file path to an audio asset with the specified assetName.
'    ''' </summary>
'    ''' <param name="assetName">The name of the audio asset whose URI should be returned.</param>
'    ''' <returns>The value of the specified asset.</returns>
'    ''' <remarks></remarks>
'    Public Function GetAudio(ByVal assetName As String) As Uri
'        If Not ContainsKey(Of Uri)(assetName) Then SetAudio(assetName, _Assets.GetAudioAsset(assetName))
'        Return GetValue(Of Uri)(assetName)
'    End Function

'    ''' <summary>
'    ''' Gets the Bitmap instance for an image asset with the specified assetName.
'    ''' </summary>
'    ''' <param name="assetName">The name of the image asset Bitmap to return.</param>
'    ''' <returns>The value of the specified asset.</returns>
'    ''' <remarks></remarks>
'    Public Function GetBitmap(ByVal assetName As String) As Bitmap
'        If Not ContainsKey(Of Bitmap)(assetName) Then SetBitmap(assetName, _Assets.GetImageAsset(assetName))
'        Return GetValue(Of Bitmap)(assetName)
'    End Function

'    Public Function GetDefinitionFile(assetName As String) As String()
'        If Not ContainsKey(Of String())(assetName) Then SetDefinitionFile(assetName, _Assets.GetDefinitionFile(assetName))
'        Return GetValue(Of String())(assetName)
'    End Function

'    ''' <summary>
'    ''' Get a flag (boolean) value by name from the AssetBank.
'    ''' </summary>
'    ''' <param name="assetName">The name of the flag (boolean) to return.</param>
'    ''' <returns>The value of the specified asset.</returns>
'    ''' <remarks></remarks>
'    Public Function GetFlag(assetName As String) As Boolean
'        If Not ContainsKey(Of Boolean)(assetName) Then SetFlag(assetName, _Assets.GetFlagAsset(assetName))
'        Return GetValue(Of Boolean)(assetName)
'    End Function

'    ''' <summary>
'    ''' Gets an Integer value by name from the AssetBank.
'    ''' </summary>
'    ''' <param name="assetName">The name of the Integer value to return.</param>
'    ''' <returns>The value of the specified asset.</returns>
'    ''' <remarks></remarks>
'    Public Function GetInteger(ByVal assetName As String) As Integer
'        If Not ContainsKey(Of Integer)(assetName) Then SetInteger(assetName, _Assets.GetIntegerAsset(assetName))
'        Return GetValue(Of Integer)(assetName)
'    End Function

'    ''' <summary>
'    ''' Gets a Single value by name from the AssetBank.
'    ''' </summary>
'    ''' <param name="assetName">The name of the Single value to return.</param>
'    ''' <returns>The value of the specified asset.</returns>
'    ''' <remarks></remarks>
'    Public Function GetSingle(ByVal assetName As String) As Single
'        If Not ContainsKey(Of Single)(assetName) Then SetSingle(assetName, _Assets.GetSingleAsset(assetName))
'        Return GetValue(Of Single)(assetName)
'    End Function

'    ''' <summary>
'    ''' Gets a String value by name from the AssetBank.
'    ''' </summary>
'    ''' <param name="assetName">The name of the String value to return.</param>
'    ''' <returns>The value of the specified asset.</returns>
'    ''' <remarks></remarks>
'    Public Function GetString(ByVal assetName As String) As String
'        If Not ContainsKey(Of String)(assetName) Then SetString(assetName, _Assets.GetStringAsset(assetName))
'        Return GetValue(Of String)(assetName)
'    End Function

'    ''' <summary>
'    ''' Adds the specified audio asset to the AssetBank.
'    ''' </summary>
'    ''' <param name="assetName">The name of the asset to add.</param>
'    ''' <param name="assetValue">The Uri of the audio file.</param>
'    ''' <remarks></remarks>
'    Protected Friend Sub SetAudio(ByVal assetName As String, ByVal assetValue As Uri)
'        SetValue(Of Uri)(assetName, assetValue)
'    End Sub

'    ''' <summary>
'    ''' Adds the specified image asset to the AssetBank.
'    ''' </summary>
'    ''' <param name="assetName">The name of the asset to add.</param>
'    ''' <param name="assetValue">The Image object for the asset.</param>
'    ''' <remarks></remarks>
'    Protected Friend Sub SetBitmap(ByVal assetName As String, ByVal assetValue As Bitmap)
'        SetValue(Of Bitmap)(assetName, assetValue)
'    End Sub

'    Protected Friend Sub SetDefinitionFile(assetName As String, assetValue() As String)
'        SetValue(Of String())(assetName, assetValue)
'    End Sub

'    ''' <summary>
'    ''' Adds the specified flag (boolean) asset to the AssetBank.
'    ''' </summary>
'    ''' <param name="assetName">The name of the asset to add.</param>
'    ''' <param name="assetValue">The value of the flag (boolean) to add.</param>
'    ''' <remarks></remarks>
'    Protected Friend Sub SetFlag(assetName As String, assetValue As Boolean)
'        SetValue(Of Boolean)(assetName, assetValue)
'    End Sub

'    ''' <summary>
'    ''' Adds an Integer value to the AssetBank.
'    ''' </summary>
'    ''' <param name="assetName">The name of the asset to add.</param>
'    ''' <param name="assetValue">The value of the Integer to add.</param>
'    ''' <remarks></remarks>
'    Protected Friend Sub SetInteger(ByVal assetName As String, ByVal assetValue As Integer)
'        SetValue(Of Integer)(assetName, assetValue)
'    End Sub

'    ''' <summary>
'    ''' Adds an Single value to the AssetBank.
'    ''' </summary>
'    ''' <param name="assetName">The name of the asset to add.</param>
'    ''' <param name="assetValue">The value of the Single to add.</param>
'    ''' <remarks></remarks>
'    Protected Friend Sub SetSingle(ByVal assetName As String, ByVal assetValue As Single)
'        SetValue(Of Single)(assetName, assetValue)
'    End Sub

'    ''' <summary>
'    ''' Adds an String value to the AssetBank.
'    ''' </summary>
'    ''' <param name="assetName">The name of the asset to add.</param>
'    ''' <param name="assetValue">The value of the String to add.</param>
'    ''' <remarks></remarks>
'    Protected Friend Sub SetString(ByVal assetName As String, ByVal assetValue As String)
'        SetValue(Of String)(assetName, assetValue)
'    End Sub
'End Class
